Available Actions

The actions shown to the left in the image below are calculated by the Framework. You can have class actions – actions associated with a class in your model. These will show up whenever an object of that class is shown in your view.

  • You can also have ViewModel actions and these only show up in the view they are defined for.
  • You have the ability to instruct the logic to make exceptions for the calculated display of actions. You can opt out of the presentation of actions per view.
  • Actions may be used for navigation, but they may also perform something – like calling a method on an object.

In our example, we already have some actions – both ViewModel actions, Class actions, and Global actions (the ones that build up the main menu).

Prototyping - 26.png

Look closely at the ShowRentalContract action. This is a Class action – available everywhere a RentalContract is shown. However, there are situations where we do not want it to show – like when we already are in the view that is brought up by the action:

Prototyping - 27.png

To remove it, we want to opt out. There are two tools in MDrivenDesigner that are good to use for this. The first one is the ViewModelEditor:

Prototyping - 28.png

Pressing the “>” button will move it to the opt out column:

Prototyping - 29.png

You can press the “<” to opt in again. The other place you can opt out of actions from is the Action Cross Reference window:

Prototyping - 30.png
Prototyping - 31.png

In this window, we see the actions that will bring this view up. Currently, there are 2 actions: the NewRentalContract and the ShowRentalContract.

We also see the actions that will show and a line to which section or nesting of the ViewModel it refers. You may click the lines and shift them from green (opt in default) to opt out. Since we already opted out of our ShowRentalContract from this view, that line is already red.

There are also tools for looking at this from a specific action perspective. In the ActionsEditor, we see this for the ShowRentalContract Action:

Prototyping - 32.png

It says “Action shows in 2 places. 1 Opted out” followed by a dialog button. Click that and you will see this:

Prototyping - 33.png

Here we see that it is opt out in the ViewAndEditRentalContract view, but it shows 2 times in the SearchForRentalContracts view. I switch back to prototyping to verify this:

Prototyping - 34.png

And find that this is true. The reason for this is the fact that this ViewModel defines two areas that have the type RentalContract: one for the root and one for the Grid-nesting that shows the results from the variable vSeekerResult.

Prototyping - 35.png

The root instance will always be null since this ViewModel does not require a root object to function. ViewModels designed for seeking seldom do. If it always will be null then there is little point in having an action that will be enabled only if it is assigned to an object. We should opt that root action out. Click the line to toggle the opt out state:

Prototyping - 36.png

The ActionEditor was updated as well:

Prototyping - 37.png

It now says the Action shows in 1 place – 2 opted out. I have had my prototyping session running all along – but it still uses the model we had prior to our changes. I can now restart the prototyping by clicking Play again, bringing up a new prototype window. Or I can just reread the model to the one I have. I see that the ShowRentalContract action is shown only once.

Prototyping - 38.png

If you are alone for a day and you have lots of ideas, I assure you that you can model them in MDriven Designer and verify them in MDriven Prototyper. When you are able to try and verify ideas rapidly, you will find many “think bugs” early. Bugs that make you say things like: “Oh, no – that is not a good way of doing it!”. Since the MDriven environment works as your autopilot and it has tens of thousands of flight hours under its belt, you will be freer in the creative part of your work.

The MDriven Book - Next Chapter: MDriven Server Introduction 

This page was edited 46 days ago on 10/02/2024. What links here